import time
from time import sleep

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

driver = webdriver.Chrome(executable_path='chromedriver.exe')
driver.get("http://121.43.169.97:8848/pageA.html")
# #最大化浏览器
driver.maximize_window()
# #刷新
# driver.refresh()
# #后退
# driver.back()
# #前进
# driver.forward()
# #设置浏览器大小
# driver.set_window_size(300,300)
# #设置浏览器位置
# driver.set_window_position(300,200)
# #关闭浏览器单个窗口
# driver.close()
# #关闭浏览器所有窗口
# driver.quit()
# #获取title
# title=driver.title
# #获取当前页面url
# url=driver.current_url

# 需求：打开注册A页面，完成以下操作
# 1).通过脚本执行输入用户名：admin；密码：123456；电话号码：18611111111；电子邮件：123@qq.com
driver.find_element(By.ID,"userA").send_keys("admin")
driver.find_element(By.CSS_SELECTOR,"[name='passwordA']").send_keys("123456")
driver.find_element(By.CSS_SELECTOR,".telA").send_keys("18611111111")
driver.find_element(By.XPATH,"//p[4]/input").send_keys("123@qq.com")
# 2).间隔3秒，修改电话号码为：18600000000
sleep(3)
driver.find_element(By.CSS_SELECTOR,".telA").clear()
driver.find_element(By.CSS_SELECTOR,".telA").send_keys("18600000000")
# 3).间隔3秒，点击‘注册’按钮
sleep(3)
driver.find_element_by_css_selector("button").click()

# 4).间隔3秒，关闭浏览器
sleep(3)
driver.quit()
# 5).元素定位方法不限